import java.util.Scanner;

public class Resign {
    public static void main(String[] args) {
        int maxNum=3;
        int passWord=1234;
        Scanner scanner = new Scanner(System.in);
        while(true){
            if (maxNum==0){
                System.out.println("次数已耗尽！");
                break;
            }
            System.out.println("请输入密码");
            int input = scanner.nextInt();
            if (input==passWord){
                System.out.println("密码正确，正在登陆！");
                break;
            }else {
                maxNum--;
                System.out.println("密码错误"+"("+input+")"+"请重新输入！"+"还剩"+maxNum+"次机会");
            }
        }
    }
}
